
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{margin: 0;padding: 0;}
        html,body{
            height: 100%;
            width: 100%;
            overflow: hidden;
            background: url(./images3/bg.jpg) no-repeat;
            background-size: 100% 100%;
        }
    </style>
    <script src="./js/animate.js"></script>
</head>
<body>
    <script>
        // class Fireworm{
        //     constructor(){
        //         this.el=document.createElement("div");
        //         document.body.appendChild(this.el);
        //         this.el.style.width="20px";
        //         this.el.style.height="20px";
        //         this.el.style.position="absolute";
        //         this.el.style.backgroundImage="url(./images3/1.jpg)";
        //         this.el.style.backgroundRepeat="no-repeat";
        //         this.el.style.backgroundSize="100% 100%";

        //         this.el.style.left=this.location().left+"px";
        //         this.el.style.top=this.location().top+"px";
        //     }

        //     location(){
        //         return{
        //             left:parseInt(document.documentElement.clientWidth*Math.random()),
        //             top:parseInt(document.documentElement.clientHeight*Math.random())
        //         }
        //     }
        //     fly(){
        //         tools.animate(this.el,this.location(),()=>{
        //             this.fly();
        //         })
        //     }
        // }
        // new Fireworm().fly();


        function FireWrom(ele){
            this.el=document.createElement("div");
            document.body.appendChild(this.el);
            this.el.style.width="20px";
            this.el.style.height="20px";
            this.el.style.position="absolute";
            this.el.style.backgroundImage="url(./images3/1.jpg)";
            this.el.style.backgroundRepeat="no-repeat";
            this.el.style.backgroundSize="100% 100%";

            this.location=function(){
                return{
                    left:parseInt(document.documentElement.clientWidth*Math.random()),
                    top:parseInt(document.documentElement.clientHeight*Math.random())
                }
            }
            this.fly=function(){
                tools.animate(this.el,this.location(),()=>{
                    this.fly();
                })
            }
            this.el.style.left=this.location().left+"px";
            this.el.style.top=this.location().top+"px";
        }

        new FireWrom().fly();
    </script>
</body>
</html>